package edu.cmu.cs.stage3.alice.authoringtool.datatransfer;

/**
 * @author Jason Pratt
 */
public class ResponsePrototypeReferenceTransferable extends ElementPrototypeReferenceTransferable {

        //LOB version using 'mimeType' to create 'java.awt.datatransfer.DataFlavor' produce error in Java 5, changed to 'Class'
	// public final static java.awt.datatransfer.DataFlavor responsePrototypeReferenceFlavor = new java.awt.datatransfer.DataFlavor( java.awt.datatransfer.DataFlavor.javaJVMLocalObjectMimeType + "; class=edu.cmu.cs.stage3.alice.authoringtool.util.ResponsePrototype", "responsePrototypeReferenceFlavor" );
	public final static java.awt.datatransfer.DataFlavor responsePrototypeReferenceFlavor
               = new java.awt.datatransfer.DataFlavor(edu.cmu.cs.stage3.alice.authoringtool.util.ResponsePrototype.class, "responsePrototypeReferenceFlavor");

	protected edu.cmu.cs.stage3.alice.authoringtool.util.ResponsePrototype responsePrototype;

	public ResponsePrototypeReferenceTransferable( edu.cmu.cs.stage3.alice.authoringtool.util.ResponsePrototype responsePrototype ) {
		super( responsePrototype );
		this.responsePrototype = responsePrototype;

		flavors = new java.awt.datatransfer.DataFlavor[3];
		flavors[0] = responsePrototypeReferenceFlavor;
		flavors[1] = ElementPrototypeReferenceTransferable.elementPrototypeReferenceFlavor;
		flavors[2] = java.awt.datatransfer.DataFlavor.stringFlavor;
	}

	//Rem @Override
	public Object getTransferData( java.awt.datatransfer.DataFlavor flavor ) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException {
		if( flavor.equals( responsePrototypeReferenceFlavor ) ) {
			return responsePrototype;
		} else if( flavor.equals( ElementPrototypeReferenceTransferable.elementPrototypeReferenceFlavor ) ) {
			return responsePrototype;
		} else if( flavor.equals( java.awt.datatransfer.DataFlavor.stringFlavor ) ) {
			return responsePrototype.toString();
		} else {
			throw new java.awt.datatransfer.UnsupportedFlavorException( flavor );
		}
	}
}
